
package helloservice.endpoint;

import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;

public class HelloClient {
  
  public static void main(String[] args) throws Exception {
      URL url = new URL("http://localhost:9876/endpoint?wsdl");
      QName qname = new QName("http://endpoint.helloservice/", "HelloServerImplService");

      Service service = Service.create(url, qname);
      HelloServer eif = service.getPort(HelloServer.class);
  
      System.out.println("Retrieving the port from the following service: " + service);
  
      System.out.println("Invoking the sayHello operation on the port.");

      String name;
      if (args.length > 0) {
        name = args[0];
      } else {
        name = "No Name";
      }

      String response = eif.sayHello(name);
      System.out.println(response);
  }
} 

